package com.noocodecommit.wicket.jquery.plugin.lightbox;

import org.apache.wicket.markup.html.image.ContextImage;
import org.apache.wicket.model.Model;

import com.noocodecommit.wicket.jquery.TemplatePage;
import com.noocodecommit.wicket.stuff.jquery.JQCore;
import com.noocodecommit.wicket.stuff.jquery.plugin.chili.JQChili;
import com.noocodecommit.wicket.stuff.jquery.plugin.lightbox.JQLightboxLink;
import com.noocodecommit.wicket.stuff.jquery.plugin.lightbox.JQLightboxPlugin;
import com.noocodecommit.wicket.stuff.jquery.plugin.ui.tabs.JQTabs;

public class LightboxPage extends TemplatePage
{
	private final JQTabs tabContainer;

	public LightboxPage()
	{
		super();
		JQCore.init(this);
		this.setupChili();

		tabContainer = new JQTabs("tab-container");
		tabContainer.setOutputMarkupId(true);
		add(tabContainer);
		
		/**
		 * Lightbox
		 */
		JQLightboxPlugin plugin1 = new JQLightboxPlugin(JQLightboxPlugin.DEFAULT_KEY);
		plugin1.getOptions().setNavbarOnTop(true);

		JQLightboxLink lightboxlink1 = new JQLightboxLink("lighboxlink1", "images/lightbox/image-1.jpg", "lightbox", "album1");
		lightboxlink1.setTitle("jQuery Lightbox Sample Image");
		ContextImage img1 = new ContextImage("img1", new Model("images/lightbox/thumb-1.jpg"));
		lightboxlink1.add(img1);
		tabContainer.add(lightboxlink1);

		JQLightboxLink lightboxlink2 = new JQLightboxLink("lighboxlink2", "images/lightbox/image-2.jpg", "lightbox", "album1");
		lightboxlink2.setTitle("Photo by Steven Pinker");
		ContextImage img2 = new ContextImage("img2", new Model("images/lightbox/thumb-2.jpg"));
		lightboxlink2.add(img2);
		tabContainer.add(lightboxlink2);
		
		/**
		 * Lightbox
		 */
		JQLightboxPlugin plugin2 = new JQLightboxPlugin("unecle");
		plugin2.setInitOnceSelector(".uneclasse");
		plugin2.getOptions().setDisplayTitle(false);

		JQLightboxLink lightboxlink3 = new JQLightboxLink("lighboxlink3", "images/lightbox/image-3.jpg", "uneclasse", "album2", null, "unecle");
		lightboxlink3.setTitle("Photo by Uwe Hermann");
		ContextImage img3 = new ContextImage("img3", new Model("images/lightbox/thumb-3.jpg"));
		lightboxlink3.add(img3);
		tabContainer.add(lightboxlink3);
		
		JQLightboxLink lightboxlink4 = new JQLightboxLink("lighboxlink4", "images/lightbox/image-2.jpg", "uneclasse", "album2", null, "unecle");
		lightboxlink4.setTitle("Photo by Steven Pinker");
		ContextImage img4 = new ContextImage("img4", new Model("images/lightbox/thumb-2.jpg"));
		lightboxlink4.add(img4);
		tabContainer.add(lightboxlink4);
		
		JQChili chili1 = new JQChili("chili1");
		tabContainer.add(chili1);
		this.bindChiliCode(chili1, this.getClass(), "html");

		JQChili chili2 = new JQChili("chili2");
		tabContainer.add(chili2);
		this.bindChiliCode(chili2, this.getClass(), "java");

		JQCore.get().bindOnDocumentReadyFunction();
	}
}